package com.lin.linchatgpt.exception.handler;

import com.lin.linchatgpt.utils.LinResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLIntegrityConstraintViolationException;

/**
 * Copyright(C),2022年-2022,霖霖
 *
 * @author 霖霖
 * @version 1.0
 * @date 2023/6/12 23:06
 * @Description
 */
@RestControllerAdvice
public class SQLExceptionHandler {
    @ExceptionHandler(SQLIntegrityConstraintViolationException.class)
    public LinResult handlerLinException(SQLIntegrityConstraintViolationException e){
        return LinResult.error().message(e.getMessage());
    }
}
